<%@ page import="java.util.List" %>
<%@ page import="com.foreknow.model.Guestbook" %>
<%--
  Created by IntelliJ IDEA.
  User: DELL
  Date: 2020-2-27
  Time: 9:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="pager" uri="http://blog.zjjlive.net/zjjlive/tags/pager" %>
<%
    //全局变量
    String path=request.getContextPath();
    session.setAttribute("path",path);
%>
<html>
<head>
    <title>所有信息</title>
<%--    request.getContextPath()；获取项目名称 （要使用全路径）--%>
    <link rel="stylesheet" href="${path}/css/bootstrap.min.css">
</head>
<body>
<%--jsp是用来显示的;也叫视图view--%>
    <div class="container">
        username:${sessionScope.username}
        <table class="table table-hover">
            <tr>
                <td>id</td>
                <td>name</td>
                <td>phone</td>
                <td>email</td>
                <td>title</td>
                <td>content</td>
                <td>creaetime</td>
                <td>操作</td>
            </tr>
            <c:forEach var="gb" items="${requestScope.list}" varStatus="status">
                <tr>
                    <td>${status.index+1}</td>
                    <td>${gb.name}</td>
                    <td>${gb.phone}</td>
                    <td>${gb.email}</td>
                    <td>${gb.title}</td>
                    <td>${gb.content}</td>
                    <td>${gb.createdtime}</td>
                    <td>
<%--                 超链接请求默认是get方法--%>
                    <a href="${path}/user/manager?id=${gb.id}&q=idList" class="btn btn-primary">修改</a>
                    <a href="${path}/user/manager?id=${gb.id}&q=delete" class="btn btn-danger">删除</a>
                    </td>
                </tr>
            </c:forEach>
        </table>
        <div>
            <a href="${path}/AddMessage.html" class="btn btn-primary">添加信息</a>
<%--            不能使用全路径--%>
            <pager:pager pageNo="${requestScope.pageNo}" recordCount="${requestScope.total}" pageSize="${initParam.pageSize}" url="${path}/user/manager?q=list"/>
        </div>
    </div>
</body>
</html>
